var parentVue = new Vue({
    el: "#effectStatistics",
    data: {
        loading: false,
        ctx: ctx,
        curHeight: (document.documentElement.clientHeight || document.body.clientHeight),//当前屏幕高度
        civicismApproveOverView:[], // 头部审批情况
        civicismApproveTime:{},
        electric:[],
        banjianLoading: false,
        taskDefKeyOptionData:[
            {
                itemName:'报装受理',
                itemCode:'shouli'
            },
            {
                itemName:'方案共享',
                itemCode:'fangangongxiang'
            },
            {
                itemName:'外线报装',
                itemCode:'waixianbaozhuang'
            },
            {
                itemName:'验收备案',
                itemCode:'yanshoubeian'
            },
            {
                itemName:'完工登记',
                itemCode:'wangongdengji'
            },
        ],
        dicContents: {}, // 数据字典数据
        categoryType: [
            {
                label: '用水报装',
                name: '01',
                value: 0,
            },
            {
                label: '用电报装',
                name: '02',
                value: 0,
            },
            {
                label: '用气报装',
                name: '03',
                value: 0,
            },
            {
                label: '通信报装',
                name: '04',
                value: 0,
            },
        ], // 报装类型数据
        applyStates: [
            {
                label: '0',
                name: '已接件',
            },
            {
                label: '1',
                name: '受理中',
            },
            {
                label: '2',
                name: '已受理',
            },
            {
                label: '3',
                name: '待补全',
            },
            {
                label: '4',
                name: '已补全',
            },
            {
                label: '5',
                name: '不予受理',
            },
            {
                label: '6',
                name: '已办结',
            },
            {
                label: '14',
                name: '撤件办结',
            },
            {
                label: '15',
                name: '待复验',
            },
            {
                label: '16',
                name: '已退件',
            },
            {
                label: '17',
                name: '待整改',
            },
            {
                label: '18',
                name: '申报退件',
            },
        ], // 办理状态
        dateRange: [],
        // tableData: [],
        totalLoading: false, // 头部模块的加载效果
        analysisLoading: false,// 各类型申报统计加载效果
        startTime: '', // 开始时间yyyy-MM-dd HH:mm:ss
        endTime: '', // 结束时间

        dateActive: 'all', // 时间切换类型
        approveInfoLoading: false,
        xAxisBar: [],
        dicRegions: [], // 区域下拉框数据
        dicRegionFirst: {}, // 第一个城市
        searchForm: {
            daterange: [],
            regions: ['all'],
            keyword: '',
            curRegion: '全部',
            regionNames: [],
            pageNum: 1,
            pageSize: 5
        },
        listCivicismApplyData: [],
        total: 0,
        search: {
            applyStates: [],
            keyword: '',
            pagination: {
                page: 1,
                pages: 1,
                perpage: 5
            },
        },
        //20210820 --------------------
        iteminsts: [],
        itemNum: 0,
        banjieRate: '0',
        projNum: 0,
        avgSpanTime: '0',
        orgSpanTimes: [],
        overDateRate: '0',
        applyNum: 0,
        avgApproveTime: '0',
        startPickerOptions: {
            disabledDate(time) {
                return time.getTime() > Date.now();
            },
        },
        endPickerOptions: {
            disabledDate(time) {
                return time.getTime() > Date.now();
            },
        }
    },
    created: function () {
        this.getListBscDicRegion();
        this.getDicContents();
    },
    mounted: function () {
        this.changeDate('all');
    },
    methods: {
        getListBscDicRegion: function () {
            var ts = this
            request('', {
                type: 'get',
                url: ctx + 'rest/conditional/query/listBscDicRegion'
            }, function (res) {
                if (res.success) {
                    if (res.content && res.content.length) {
                        ts.dicRegionFirst = res.content[0]
                        ts.dicRegions = res.content[0].children.map(function (item) {
                            ts.$set(item, 'isCheck', false)
                            return item
                        })
                        ts.dicRegions.unshift({
                            regionId: 'all',
                            regionName: '全部',
                            isCheck: true
                        })
                        ts.dicRegions.push({
                            regionId:  ts.dicRegionFirst.regionId,
                            regionName: '市区',
                            isCheck: false
                        })
                    }
                }
            }, function (err) {

            })
        },
        // 刷新数据
        freshFn: function () {
            this.getApproveInfo()
            // 市政报装列表
            this.getlistCivicismApply();
        },
        // 获取市政审批概况
        getApproveInfo:function(){
            var ts = this,
                params = {};
            if (ts.period) {
                params = {
                    period: ts.period
                }
            } else {
                params = {
                    startDate: ts.startTime,
                    endDate: ts.endTime,
                }
            }
            if (ts.searchForm.regions && ts.searchForm.regions.length > 0 && !(ts.searchForm.regions.indexOf('all') > -1)) {
                params.regionIds = ts.searchForm.regions.join(',');
            }
            ts.banjianLoading = true;
            request('', {
                type: 'get',
                url: ctx + 'civicism/statistics/civicismApproveInfo',
                data: params,
            }, function (res) {
                if (res.success && res.content) {
                    for (var respDataKey in res.content) {
                        ts[respDataKey] = res.content[respDataKey];
                    }
                    ts.electric = res.content.civicismApproveTime.electric||[];
                    ts.initPie();

                    ts.initApprveTimeWaterUnOutlineBar();
                    ts.initApprveTimeWaterOutlineBar();

                    ts.initApprveTimeGasUnOutlineBar();
                    ts.initApprveTimeGasOutlineBar();

                    ts.initApproveTimeElectricBar();
                }
                ts.banjianLoading = false
            }, function (err) {
                ts.banjianLoading = false
            })
        },
        initPie:function(){
            var ts = this
            ts.$nextTick(function()  {
                for (var i = 0; i < ts.civicismApproveOverView.length; i++) {
                    var chartDom = document.getElementById('pie'+i);
                    var barChart = echarts.init(chartDom);

                    var bgColor = '#fff';
                    var color = ['#179BFF', '#5AD8A6','#F0F2F5'];
                    // 对全部为0的数据进行处理，赋值为空数组
                    if(ts.civicismApproveOverView[i].outLineCompleteNum == 0 && ts.civicismApproveOverView[i].unOutLineCompleteNum == 0 ) {
                        var seriesData = [
                            {
                                value: ts.civicismApproveOverView[i].outLineCompleteNum,
                                percent: ts.civicismApproveOverView[i].outLineCompletePercent,
                                name: '有外线工程',
                                labelLine: {
                                    show: true
                                },
                                label: {
                                    show: true
                                },
                            },
                            {
                                value: ts.civicismApproveOverView[i].unOutLineCompleteNum,
                                percent: ts.civicismApproveOverView[i].unOutLineCompletePercent,
                                name: '无外线工程',
                                labelLine: {
                                    show: true
                                },
                                label: {
                                    show: true
                                },
                            },
                            {
                                value:100,
                                name: 'c类',
                                labelLine: {
                                    show: true
                                },
                                label: {
                                    show: true
                                },
                            }
                        ];
                    }else{
                        var seriesData = [
                            {
                                value: ts.civicismApproveOverView[i].outLineCompleteNum,
                                percent: ts.civicismApproveOverView[i].outLineCompletePercent,
                                name: '有外线工程',
                                labelLine: {
                                    show: true
                                },
                                label: {
                                    show: true
                                },
                            },
                            {
                                value: ts.civicismApproveOverView[i].unOutLineCompleteNum,
                                percent: ts.civicismApproveOverView[i].unOutLineCompletePercent,
                                name: '无外线工程',
                                labelLine: {
                                    show: true
                                },
                                label: {
                                    show: true
                                },
                            },
                            {
                                value: ts.civicismApproveOverView[i].unCompleteNum - ts.civicismApproveOverView[i].outLineCompleteNum - ts.civicismApproveOverView[i].unOutLineCompleteNum,
                                name: 'c类',
                                labelLine: {
                                    show: true
                                },
                                label: {
                                    show: true
                                },
                            }
                        ];

                    }

                    var  formatNumber = function (num) {
                        var reg = /(?=(\B)(\d{3})+$)/g;
                        return num.toString().replace(reg, ',');
                    };
                    var total = Number(ts.civicismApproveOverView[i].outLineCompletePercent)+Number(ts.civicismApproveOverView[i].unOutLineCompletePercent)
                    var option = {
                        title: {//标题组件
                            textStyle: {
                                color: "#333333",
                                fontSize: 12,
                            }
                        },
                        graphic: [
                            {
                                type: 'text',
                                top: '50%',
                                left: '11%',
                                style: {
                                    text: total.toFixed(2) + '%',
                                    fill: '#0D1C28',
                                    fontSize: 20,
                                    fontWeight: '700'
                                }
                            }, {
                                type: 'text',
                                top: '65%',
                                left: '10%',
                                style: {
                                    text: '完工接通率',
                                    fill: '#5A5B64',
                                    fontSize: 14,
                                    fontWeight: 'normal'
                                }
                            }
                        ],
                        //圆环的颜色
                        color: color,
                        series: [
                            {
                                name: '工资占比图',//代表a的值，系列名称
                                type: 'pie',
                                avoidLabelOverlap:true, // 饼图解决标签重叠的方法
                                minShowLabelAngle:50,
                                center: ['18%', '60%'], //饼图的中心（圆心）坐标，数组的第一项是横坐标，第二项是纵坐标。
                                radius: ['50%', '64%'],//饼图的半径，数组的第一项是内半径，第二项是外半径。[ default: [0, '75%'] ]
                                animation: false,   //是否禁用动画效果
                                label: {
                                    normal: {
                                        show:false,
                                        formatter: function(params) {
                                           /* if (params.name !== 'c类') {
                                                return '{name|' + params.name + '}{value|' +
                                                    formatNumber(params.value) + '}{percent|' +
                                                    params.percent.toFixed(2) + '%}';
                                            } else {
                                                params.data.labelLine.show = false
                                                params.data.label.show = false
                                            }*/
                                            params.data.labelLine.show = false
                                            params.data.label.show = false
                                        },
                                        padding: [0, -100, 25, -200],
                                        rich: {
                                            icon: {
                                                fontSize: 16,
                                            },
                                            name: {
                                                fontSize: 12,
                                                padding: [0, 5, 0, 0],
                                                color: '#3D4953',
                                            },
                                            value: {
                                                fontSize: 24,
                                                fontWeight: 'bold',
                                                color: '#0D1C28',
                                            },
                                            percent: {
                                                fontSize: 16,
                                                fontWeight: 'bold',
                                                color: '#0D1C28',
                                                padding: [0, 0, 0, 5],
                                            }
                                        },
                                    },
                                },
                                labelLine: {
                                    normal: {
                                        length: 25,
                                        length2: 180,
                                        lineStyle: {
                                            color: '#e6e6e6',
                                        },
                                    },
                                },
                                itemStyle: {
                                    normal: {
                                        show:false,
                                        borderColor: "#FFFFFF",
                                        borderWidth: 1,
                                        label: {
                                            show: false,
                                            formatter: '{d}%'
                                        },
                                        labelLine : {
                                            show : false   //隐藏标示线
                                        },
                                        lineStyle: {
                                            width: 0.1
                                        }
                                    },
                                },
                                // 系列中的数据内容数组。
                                data: seriesData
                            }
                        ]
                    };
                    option && barChart.setOption(option);
                }
            });
        },
        // 审批用时柱状图
        initApprveTimeWaterUnOutlineBar: function () {
            var ts = this;
            if(ts.civicismApproveTime.water && ts.civicismApproveTime.water.unOutline){
                var data = ts.civicismApproveTime.water.unOutline
            }else{
                var data = {
                    approveTime: [],
                    durationTime: [],
                    orgName: [],
                    overdueRate: [],
                    promiseApproveTime: [],
                }
            }
            ts.initApproveTimeCommonfn('approveTime-chart-water-unoutline',data);
        },
        initApprveTimeWaterOutlineBar: function () {
            var ts = this;
            if(ts.civicismApproveTime.water && ts.civicismApproveTime.water.outline){
                var data = ts.civicismApproveTime.water.outline
            }else{
                var data = {
                    approveTime: [],
                    durationTime: [],
                    orgName: [],
                    overdueRate: [],
                    promiseApproveTime: [],
                }
            }
            ts.initApproveTimeCommonfn('approveTime-chart-water-outline',data);
        },
        initApprveTimeGasUnOutlineBar: function () {
            var ts = this;
            if(ts.civicismApproveTime.gas && ts.civicismApproveTime.gas.unOutline){
                var data = ts.civicismApproveTime.gas.unOutline
            }else{
                var data = {
                    approveTime: [],
                    durationTime: [],
                    orgName: [],
                    overdueRate: [],
                    promiseApproveTime: [],
                }
            }
            ts.initApproveTimeCommonfn('approveTime-chart-gas-unoutline',data);
        },
        initApprveTimeGasOutlineBar: function () {
            var ts = this;
            if(ts.civicismApproveTime.gas && ts.civicismApproveTime.gas.outline){
                var data = ts.civicismApproveTime.gas.outline
            }else{
                var data = {
                    approveTime: [],
                    durationTime: [],
                    orgName: [],
                    overdueRate: [],
                    promiseApproveTime: [],
                }
            }
            ts.initApproveTimeCommonfn('approveTime-chart-gas-outline',data);
        },
        initApproveTimeCommonfn:function(dom,data){
            var ts = this
            ts.$nextTick(function(){
                var chartDom = document.getElementById(dom);
                var barChart = echarts.init(chartDom);

                option = {
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {
                            type: 'cross',
                            crossStyle: {
                                color: '#999'
                            }
                        }
                    },
                    xAxis: [
                        {
                            type: 'category',
                            axisTick: {
                                show: false,
                            },
                            axisLine: {
                                show: false,
                            },
                            data: data.orgName,
                            axisPointer: {
                                type: 'shadow'
                            }
                        }
                    ],
                    yAxis: [{
                        type: 'value',
                        interval: 50,
                        axisLabel: {
                            formatter: '{value}'
                        },
                        axisTick: {
                            show: false,
                        },
                        axisLine: {
                            show: false,
                        },
                        splitLine:{//分割线
                            show:true,
                            lineStyle: {
                                type:'dashed',
                                color: "rgba(223,224,226,1)",
                            }
                        }
                    }, {
                        type: 'value',
                        splitLine: {
                            show: false,
                        },
                        interval: 50,
                        min: 0,
                        max: 100,
                        axisLabel: {
                            formatter: '{value} %'
                        },
                        axisTick: {
                            show: false,
                        },
                        axisLine: {
                            show: false,
                        }
                    }],
                    series: [
                        {
                            name: '平均审批时间',
                            type: 'bar',
                            barWidth: "14",
                            //柱状图间距
                            barGap:"100%",
                            itemStyle: {
                                normal: {
                                    // 统一设置四个角的圆角大小
                                    barBorderRadius: 7,
                                    //设置柱状图颜色渐变
                                    color:"#179BFF"
                                }
                            },
                            data: data.approveTime
                        },
                        {
                            name: '平均跨度时间',
                            type: 'bar',
                            barWidth: "14",
                            //柱状图间距
                            barGap:"100%",
                            itemStyle: {
                                normal: {
                                    // 统一设置四个角的圆角大小
                                    barBorderRadius: 7,
                                    //设置柱状图颜色渐变
                                    color:"#5AD8A6"
                                }
                            },
                            data: data.durationTime
                        },
                        {
                            name: '承诺审批用时',
                            type: 'line',
                            barWidth: "14",
                            //柱状图间距
                            barGap:"100%",
                            itemStyle: {
                                normal: {
                                    //设置柱状图颜色渐变
                                    color:"#FF7368"
                                }
                            },
                            lineStyle:{
                                width:2,
                                type:'dotted'  //'dotted'点型虚线 'solid'实线 'dashed'线性虚线
                            },
                            data: data.promiseApproveTime
                        },
                        {
                            name: '逾期率',
                            type: 'line',
                            yAxisIndex: 1,
                            itemStyle: {
                                normal: {
                                    color:"#FFBA17"//设置柱状图颜色渐变

                                }
                            },
                            data: data.overdueRate
                        }
                    ]
                };

                option && barChart.setOption(option);

            })
        },
        initApproveTimeElectricBar:function () {
            var ts = this
            ts.$nextTick(function(){
                for (var i = 0; i < ts.electric.length; i++) {
                    var chartDom = document.getElementById('approveTime-chart-electric'+i);
                    var barChart = echarts.init(chartDom);

                    option = {
                        tooltip: {
                            trigger: 'axis',
                            axisPointer: {
                                type: 'cross',
                                crossStyle: {
                                    color: '#999'
                                }
                            }
                        },
                        xAxis: [
                            {
                                type: 'category',
                                data: ts.electric[i].orgName,
                                axisTick: {
                                    show: false,
                                },
                                axisLine: {
                                    show: false,
                                },
                                axisPointer: {
                                    type: 'shadow'
                                }
                            }
                        ],
                        yAxis: [
                            {
                                type: 'value',
                                name: '',
                                interval: 50,
                                axisTick: {
                                    show: false,
                                },
                                axisLine: {
                                    show: false,
                                },
                                axisLabel: {
                                    formatter: '{value} '
                                }
                            },
                            {
                                type: 'value',
                                name: '',
                                interval: 5,
                                axisTick: {
                                    show: false,
                                },
                                axisLine: {
                                    show: false,
                                },
                                axisLabel: {
                                    formatter: '{value}'
                                }
                            }
                        ],
                        series: [
                            {
                                name: '平均审批时间',
                                type: 'bar',
                                barWidth: "14",
                                //柱状图间距
                                barGap:"100%",
                                itemStyle: {
                                    normal: {
                                        // 统一设置四个角的圆角大小
                                        barBorderRadius: 7,
                                        //设置柱状图颜色渐变
                                        color:"#179BFF"
                                    }
                                },
                                data: ts.electric[i].approveTime,
                            },
                            {
                                name: '平均跨度时间',
                                type: 'bar',
                                barWidth: "14",
                                //柱状图间距
                                barGap:"100%",
                                itemStyle: {
                                    normal: {
                                        // 统一设置四个角的圆角大小
                                        barBorderRadius: 7,
                                        //设置柱状图颜色渐变
                                        color:"#5AD8A6"
                                    }
                                },
                                data:  ts.electric[i].durationTime,
                            },
                            {
                                name: '承诺审批用时',
                                type: 'line',
                                barWidth: "14",
                                //柱状图间距
                                barGap:"100%",
                                itemStyle: {
                                    normal: {
                                        //设置柱状图颜色渐变
                                        color:"#FF7368"
                                    }
                                },
                                lineStyle:{
                                    width:2,
                                    type:'dotted'  //'dotted'点型虚线 'solid'实线 'dashed'线性虚线
                                },
                                data: ts.electric[i].promiseApproveTime,
                            },
                            {
                                name: '逾期率',
                                type: 'line',
                                yAxisIndex: 1,
                                itemStyle: {
                                    normal: {
                                        color:"#FFBA17"//设置柱状图颜色渐变

                                    }
                                },
                                data:ts.electric[i].overdueRate,
                            }
                        ]
                    };

                    option && barChart.setOption(option);
                }
            })
        },

        // 获取市政报装table表格数据
        getlistCivicismApply: function () {
            var ts = this,
                params = JSON.parse(JSON.stringify(ts.search));
            if (params.categoryTypes && params.categoryTypes.length > 0) {
              params.categoryTypes = params.categoryTypes.join(",");
            } else {
              delete params.categoryTypes
            }
            if (ts.search.applyStates && params.applyStates.length > 0) {
                params.applyStates = params.applyStates.join(",");
            } else {
                delete params.applyStates
            }
            if (ts.search.taskDefKeys && params.taskDefKeys.length > 0) {
                params.taskDefKeys = params.taskDefKeys.join(",");
            } else {
                delete params.taskDefKeys
            }
            if (ts.period) {
                params.period = ts.period;
            } else {
                params.startDate = ts.startTime;
                params.endDate = ts.endTime;
            }
            if (ts.searchForm.regions && ts.searchForm.regions.length > 0 && !(ts.searchForm.regions.indexOf('all') > -1)) {
                params.regionIds = ts.searchForm.regions.join(',');
            }
            ts.banjianLoading = true;
            request('', {
                type: 'get',
                url: ctx + 'civicism/statistics/applyHandleDetail',
                data: params,
            }, function (res) {
                if (res.success && res.content) {
                    ts.listCivicismApplyData = res.content.list || [];
                    ts.total = res.content.total;
                }
                ts.banjianLoading = false
            }, function (err) {
                ts.banjianLoading = false
            })
        },
        // 查看
        toDetail: function (row) {
            var ts = this;
            var taskId = row.taskId;
            var viewId = row.viewId || '39e32f68-0e67-4c5a-abc3-6cd9f8a1b908';
            var url = ctx + "apanmis/page/stageApproveIndex?isNotCompareAssignee=true&observer=true&taskId=" + taskId + "&viewId=" + viewId;
            if (taskId) {
                var tempwindow = window.open(); // 先打开页面
                setTimeout(function () {
                    tempwindow.location = url
                }, 0)
            } else {
                ts.$message('请确保拿到taskId,不能为空');
            }
        },
        // 催办
        sendRemind: function (row) {
            var ts = this;
            if (!row.loading) {
                ts.$set(row, 'loading', true);
            }
            var taskId = row.taskId;
            var procinstId = row.procinstId
            var applyinstId = row.applyinstId;
            var viewId = row.viewId || "cc06641e-f6e6-4dd7-bcc7-591e23080c6a"
            var url = ctx + "apanmis/page/municipalSupervisionDetail.html?isNotCompareAssignee=true&taskId=" + taskId + "&applyinstId=" + applyinstId + "&isUrge=true&procInstId=" + procinstId + "&viewId=" + viewId;
            if (taskId && applyinstId) {
                ts.$set(row, 'loading', false);
                var tempwindow = window.open(); // 先打开页面
                setTimeout(function () {
                    tempwindow.location = url
                }, 0)
            } else {
                ts.$set(row, 'loading', false);
                ts.$message('请确保拿到taskId、applyinstId,不能为空');
            }
        },
        handleSizeChange: function (size) {
            var _that = this;
            _that.search.pagination.perpage = size;
            _that.getlistCivicismApply();
        },
        handleCurrentChange: function (value) {
            var _that = this;
            _that.search.pagination.page = value;
            _that.search.pagination.pages = value;
            _that.getlistCivicismApply();
        },
        // 获取数据字典
        getDicContents: function () {
            var ts = this;
            request('', {
                    url: ctx + 'rest/common/getDicContents',
                    type: 'get',
                }, function (res) {
                    if (res.success) {
                        ts.dicContents = res.content;
                        ts.applyStates = ts.dicContents['APPLYINST_STATE'];
                    }
                },
                function (err) {

                })
        },
        // 办理状态文本
        formatMyStatus: function (val) {
            var ts = this;
            var str = '';
            ts.dicContents['APPLYINST_STATE'].forEach(function (item) {
                if (item.itemCode == val) {
                    str = item.itemName
                }
            })
            return str
        },
        // 办理状态颜色值
        applyinstStateColor: function (val) {
            if (val == 0) return "#169aff";
            if (val == 1) return "#169aff";
            if (val == 2) return "#26bd7f";
            if (val == 3) return "#ff8915";
            if (val == 4) return "#ff8915";
            if (val == 5) return "#FF4B47";
            if (val == 6) return "#26bd7f";
            if (val == 7) return "#ff8915";
            if (val == 8) return "#ff8915";
            if (val == 9) return "#ff8915";
            if (val == 10) return "#ff8915";
            if (val == 11) return "#ff8915";
            if (val == 12) return "#727475";
            if (val == 13) return "#727475";
            if (val == 14) return "#727475";
            if (val == 15) return "#ff8915";
            if (val == 16) return "#727475";
            return "#000";
        },
        // 切换时间
        changeDate: function (type, key) {
            this.dateActive = type
            if (type === 'dateRange') {
                this.period = '';
                if (this.startTime&&this.endTime) {
                    if (this.startTime>this.endTime) {
                        this.$message({
                            type: 'error',
                            message: '开始时间不能大于结束时间！'
                        })
                        return
                    }
                    this.freshFn()
                } else {
                    // 清除时间时
                    if (key ==='endTime'&&!this.endTime) {
                        this.dateActive = 'all'
                        this.startTime = ''
                        this.freshFn()
                    }
                }

                return;
            }
            var nowDate = new Date()
            var month = nowDate.getMonth();
            this.endTime = formatDate(nowDate, 'yyyy-MM-dd')
            if (type === 'month') {
                this.period = 'm';
                nowDate.setDate(1)
            } else if (type === 'quarter') {
                this.period = 'q';
                if (month < 3) {
                    nowDate.setMonth(0);
                } else if (2 < month && month < 6) {
                    nowDate.setMonth(3);
                } else if (5 < month && month < 9) {
                    nowDate.setMonth(6);
                } else if (8 < month && month < 11) {
                    nowDate.setMonth(9);
                }
                nowDate.setDate(1)
            } else if (type === 'year') {
                this.period = 'y';
                nowDate.setDate(1);
                nowDate.setMonth(0);
            }
            this.startTime = formatDate(nowDate, 'yyyy-MM-dd')
            if (type === 'all') {
                this.period = '';
                this.startTime = ''
                this.endTime = ''
            } else {
                this.startTime = this.startTime;
            }
            this.freshFn()
        },        // 区域切换
        handleCommand: function (command) {
            console.log(command)
            if (command.regionName !== '全部' && this.dicRegions[0].isCheck) {
                this.$set(this.dicRegions[0], 'isCheck', false)
            }
            command.isCheck = !command.isCheck
            if (this.isMultiple && command.isCheck) {
                this.searchForm.push(command.regionName)
                this.searchForm.regions.push(command.regionId)
                this.searchForm.curRegion = this.searchForm.regionNames.join(',')
            } else {
                this.searchForm.regions = [command.regionId]
                this.searchForm.curRegion = command.regionName
            }
            this.freshFn()
        },
        // 重置搜索
        resetSearch: function () {
            this.search = {
                // categoryTypes: [],
                applyStates: [],
                keyword: '',
                pagination: {
                    page: 1,
                    pages: 1,
                    perpage: 5
                },
            }
                this.getlistCivicismApply();
        },
        resetPagination:function(){
            this.search.pagination={
                page: 1,
                pages: 1,
                perpage: 5
            };
            this.getlistCivicismApply();
        }
    },
})